package engine.graphics.postfx
{
	import away3d.core.managers.*;
	import engine.graphics.*;
	import engine.graphics.resources.*;
	import engine.graphics.shader.*;
	import engine.math.*;
	import flash.display3D.*;
	import flash.geom.*;
	
	public class RxFilter
	{
		protected var m_vertexBuffer:VertexBuffer3D;
		protected var m_indexBuffer:IndexBuffer3D;
		protected var m_shaderProgram:RxShaderProgram;
		protected var m_textures:Vector.<RxGPUTexture2D>;
		protected var m_color:RxVector4;
		protected var m_colorConst:RxShaderConst;
		protected var m_dstRect:Rectangle;
		protected var m_srcRects:Vector.<Rectangle>;
		protected var m_depth:Number;
		protected var m_vertexShaderConstants:Vector.<Number>;
		
		public function RxFilter()
		{
			this.m_vertexBuffer = null;
			this.m_indexBuffer = null;
			this.m_shaderProgram = null;
			this.m_textures = new Vector.<RxGPUTexture2D>;
			this.m_color = new RxVector4(1, 1, 1, 1);
			this.m_colorConst = new RxShaderConst(1, 1, 1, 1);
			this.m_dstRect = null;
			this.m_srcRects = null;
			this.m_depth = 0;
			this.m_vertexShaderConstants = null;
		}
		
		public function CreateFromCode(param1:Context3D, param2:String, param3:uint) : void
		{
			var _loc_4:* = new RxFragmentShader();
			_loc_4.Compile(param2);
			this.CreateFromShader(param1, _loc_4, param3);
		}
		
		public function CreateFromShader(param1:Context3D, param2:RxFragmentShader, param3:uint) : void
		{
			/*
			var _loc_7:uint = 0;
			var _loc_8:String = null;
			var _loc_9:String = null;
			var _loc_10:String = null;
			var _loc_12:String = null;
			var _loc_4:* = this.Vector.<Number>([0, 0, 1, 0, 0, 1, 1, 1]);
			this.m_vertexBuffer = param1.createVertexBuffer(4, 2);
			this.m_vertexBuffer.uploadFromVector(_loc_4, 0, 4);
			var _loc_5:* = this.Vector.<uint>([0, 1, 2, 2, 1, 3]);
			this.m_indexBuffer = param1.createIndexBuffer(6);
			this.m_indexBuffer.uploadFromVector(_loc_5, 0, 6);
			var _loc_6:* = "mul vt0.xy, va0.xy, vc0.xy\n" + "add op.xy, vt0.xy, vc0.zw\n" + "mov op.zw, vc1\n";
			var _loc_11:String = "va0";
			_loc_7 = 0;
			while (_loc_7 < param3)
			{
				
				_loc_9 = "vc" + String(_loc_7 + 2);
				_loc_8 = "vt" + String(_loc_7 >> 1);
				_loc_10 = "v" + String(_loc_7 >> 1);
				_loc_6 = _loc_6 + ("mul " + _loc_8 + ".xy, va0.xy, " + _loc_9 + ".xy\n");
				if (_loc_7 & 1)
				{
					_loc_6 = _loc_6 + ("add " + _loc_10 + ".zw, " + _loc_8 + ".xxxy, " + _loc_9 + ".zw\n");
				}
				else
				{
					_loc_6 = _loc_6 + ("add " + _loc_10 + ".xy, " + _loc_8 + ".xy, " + _loc_9 + ".zw\n");
				}
				_loc_7 = _loc_7 + 1;
			}
			if (_loc_7 & 1)
			{
				_loc_10 = "v" + String(_loc_7 >> 1);
				_loc_6 = _loc_6 + ("mov " + _loc_10 + ".zw, va0\n");
			}
			var _loc_13:* = new RxVertexShader();
			new RxVertexShader().Compile(_loc_6);
			this.m_shaderProgram = new RxShaderProgram();
			this.m_shaderProgram.SetShaders(param1, _loc_13, param2);
			this.m_dstRect = new Rectangle();
			this.SetDstRectCoords(0, 0, 1, 1);
			this.m_srcRects = new Vector.<Rectangle>(param3, true);
			_loc_7 = 0;
			while (_loc_7 < param3)
			{
				
				this.m_srcRects[_loc_7] = new Rectangle();
				this.SetSrcRectCoords(_loc_7, 0, 0, 1, 1);
				_loc_7 = _loc_7 + 1;
			}
			this.m_vertexShaderConstants = new Vector.<Number>(4 * (2 + param3), true);*/
		}
	}
}